require("../util.js");
require("../component/components.js");
require("../../jsMt/util.js");
var userInfo=JSON.parse(sessionStorage.getItem("userInfo"));
if(!userInfo){
    location.href="/loginIndex"
}
var vm = new Vue({
    el:"#jobDetails",
    data:{
        uid:userInfo.id,
        recruitId:"",
        recruitList:{}
    },
    mounted:function(){
        this.searchObject = this.getQueryStringArgs();
        this.recruitId=this.searchObject&&this.searchObject.recruitId;
        this.getRecruitById();
    },
    methods:{
        //后退
        getBack:function(){
            history.go(-1);
        },
        bgimg:function(url){
            url = url?url:"";
            return {
                "background-image":'url("'+url+'"),url("")'
            }
        },
        /*获取查询字符对象*/
        getQueryStringArgs: function () {
            //取得查询字符串并去掉开头的问号
            var qs = (location.search.length > 0 ? location.search.substring(1) : ""),
                args = {},
                items = qs.length ? qs.split("&") : [],
                item = null,
                name = null,
                value = null,
                len = items.length;
            for (var i = 0; i < len; i++) {
                item = items[i].split("=");
                name = item[0];
                value = item[1];
                if (name.length) {
                    args[name] = value;
                }
            }
            return args;
        },
        //通过招聘id获取招聘信息
        getRecruitById:function(){
            var that=this;
            var data={
                uid:that.uid,
                recruitId:that.recruitId
            };
            //console.log(data);
            this.ajax({url:"/selfMedia/getRecruitById",data:data,dataType:"json",method:"post"},function(b){
                if(b.json.code==0){
                    that.recruitList=b.json.data;
                    console.log(that.recruitList)
                }else{
                    vm.$refs.prompt.toast("点赞失败！")
                }
            });
        }
    }
});